using System.Collections.Generic;
using GameFramework.Battle.Core;
using Gameplay.PVE.Entity;
using UnityEngine;

namespace Gameplay.PVE
{
    public class IsObeyingOrder : Havior
    {
        private BattleUnit unit;

        public override ETaskResult Execute(ETaskResult result,bool last)
        {
            if (!unit.Data.HasSpecificOrder())
            {
                return ETaskResult.Failed;
            }
            else
            {
                return ETaskResult.Successed;
            }
        }

        public override void Parse(Dictionary<string, object> data)
        {
            
        }

        public override void SharedVariableChanged(string key, object value)
        {
            if (key == ESharedVariablesType.Executor)
            {
                unit = (BattleUnit) value;
            }
        }
    }
}